import React, { useRef, useEffect } from 'react'
import * as echarts from 'echarts';

function Status() {
    const ref = useRef()

    useEffect(() => {
        var chartDom = ref.current;
        var myChart = echarts.init(chartDom);
        var option;

        option = {
            color: ['#00FE7F', '#0CA0FD', '#A05FFB', "#FAD54A", "#FC5F5E"],
            // title: {
            //     text: 'Referer of a Website',
            //     subtext: 'Fake Data',
            //     left: 'center'
            // },
            tooltip: {
                trigger: 'item'
            },
            // legend: {
            //     orient: 'vertical',
            //     left: 'left'
            // },

            // 配置环形图的显示与数据
            series: [
                {
                    name: 'Access From',
                    type: 'pie',
                    radius: ['40%', '50%'], // 40%内环圆心大小，若为0则为饼图，50%：外环圆心大小
                    avoidLabelOverlap: false,
                    // 展示数据
                    data: [
                        { value: 200, name: '已就业 86%' },
                        { value: 35, name: '未就业 8%' },
                        { value: 10, name: '返回未就业 2%' },
                        { value: 10, name: '以往未就业 2%' },
                        { value: 10, name: '返校重听 2%' }
                    ],
                    emphasis: {
                        // 修改环形中间字体样式
                        // textStyle: {
                        //     fontSize: '18',
                        //     fontWeight: 'bold',
                        //     color: '#fff'
                        // },
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };


        option && myChart.setOption(option);
    }, [])

    return (
        <div className="status-0" ref={ref}>

        </div>
    )
}

export default Status
